package com.dyh.quickdemo.demos.beanReplace;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/*
@Author=Joey Wheeler
@Date=2021/1/7 19:30
*/
//@Component

@Slf4j
//@Component
public class ScheduleConf {

    @Autowired
    ItfServiceA itfServiceA;

    /*
    Cron expression must consist of 6 fields (found 7 in "0/5 * * * * ? *")
    */
    @Scheduled(fixedRate = 2*1000)
    public void schedule(){
        log.info("schedule"+itfServiceA.a());
    }
    /*
    *
    * 2021-01-07 19:43:27.929  INFO 3736 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 3 ms
2021-01-07 19:43:28.191  INFO 3736 --- [   scheduling-1] c.d.q.demos.beanReplace.ScheduleConf     : scheduleA.a()common
    * */
}
